//
//  YMMessageInfo.h
//  YMIM
//
//  Created by reyzhang on 2022/3/21.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "YMCommonDefs.h"
#import "YMMessage.h"

NS_ASSUME_NONNULL_BEGIN

/*!
 消息的方向
 */
typedef NS_ENUM(NSUInteger, YMMessageDirection) {
    /*!
     发送
     */
    MessageDirection_SEND = 1,

    /*!
     接收
     */
    MessageDirection_RECEIVE = 2
};


/**
 * IM 接收到的消息 数据模型
 */
@interface YMMessageInfo : NSObject
@property (nonatomic, strong) NSString *groupId; //组id
@property (nonatomic, assign) NSInteger mid; //消息id
@property (nonatomic, strong) NSString *msg; //消息内容
@property (nonatomic, strong) NSString *msgTime; //发送消息时间

@property (nonatomic, assign) NSInteger msgState; //消息状态
@property (nonatomic, assign) NSInteger msgType; // 0:系统消息 1：聊天消息

@property (nonatomic, assign) NSInteger offline; //
//消息类型
@property (nonatomic, assign) NSInteger subType; // 101: 文本消息 102:音频 103:视频 104：图片 105：文件
@property (nonatomic, strong) NSString *tid; //接收者id

@property (nonatomic, strong) NSString *uid; //发送者id
@property (nonatomic, strong) NSString *userAvatar;
@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) id extraData; //使用时需要转成对象




//扩展
@property (nonatomic, assign) CGSize cellSize;
@property (nonatomic, assign) BOOL isDisplayNickname;
@property (nonatomic, strong,readonly) id extraInfo; //extraData的特殊处理


//消息方向
@property (nonatomic, assign,readonly) YMMessageDirection messageDirection;
//会话类型
@property (nonatomic, assign) YMConversationType conversationType;

/**
 * 发送消息与接收到的消息数据转换
 *
 * @param message 发送消息模型
 */
+ (instancetype)convertWithMessage:(YMMessage *)message;


@end

NS_ASSUME_NONNULL_END
